package com.example.commons.core.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/**
 * 用户角色关联表
 */
@Data
@TableName
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class UserRoleRelation {
    @TableId(type= IdType.AUTO)
    private Long id;
    /**
     * 用户id
     */
    private Long userId;
    /**
     * 角色id
     */
    private Long roleId;
    /**
     * 创建时间
     */
    private LocalDateTime createTime;

    public UserRoleRelation(Long userId, Long roleId, LocalDateTime now) {
        this.userId = userId;
        this.roleId = roleId;
        this.createTime = now;
    }
}
